<template>
  <el-tabs type="border-card">
    <el-tab-pane label="车队资料">
      <DriverTeamAdd :parent-data="parentData" />
    </el-tab-pane>
  </el-tabs>
</template>
<script>
import DriverTeamAdd from './components/driverTeamAdd.vue'
import { SelectAddress } from '@/api/orderform'
import { getListDict } from '@/api/commonApi'
export default {
  name: 'AddDriverTeamForm',
  components: { DriverTeamAdd },
  data() {
    return {
      parentData: {
        areaOptions: [],
        vehicleBindList: [],
        vehicleTypeAllowList: [],
        vehicleClassificationList: [],
        vehicleLengthList: [],
        vehicleWidthList: [],
        vehicleHighList: [],
        vehicleTonnageList: [],
        locationSourceList: []
      }
    }
  },
  created() {
    SelectAddress().then(response => {
      this.parentData.areaOptions = response.data.records
    })
    // 获取数据字典： 准驾车型，车型，车长，车宽，车高，吨位，定位来源
    getListDict({
      types:
        'vehicleTypeAllow,vehicleClassification,vehicleLength,vehicleWidth,vehicleHigh,vehicleTonnage,locationSource'
    }).then(response => {
      this.parentData.vehicleTypeAllowList = response.data.filter(
        item => item.type === 'vehicleTypeAllow'
      )[0]['dictList']
      this.parentData.vehicleClassificationList = response.data.filter(
        item => item.type === 'vehicleClassification'
      )[0]['dictList']
      this.parentData.vehicleLengthList = response.data.filter(
        item => item.type === 'vehicleLength'
      )[0]['dictList']
      this.parentData.vehicleWidthList = response.data.filter(
        item => item.type === 'vehicleWidth'
      )[0]['dictList']
      this.parentData.vehicleHighList = response.data.filter(
        item => item.type === 'vehicleHigh'
      )[0]['dictList']
      this.parentData.vehicleTonnageList = response.data.filter(
        item => item.type === 'vehicleTonnage'
      )[0]['dictList']
      this.parentData.locationSourceList = response.data.filter(
        item => item.type === 'locationSource'
      )[0]['dictList']
    })
  }
}
</script>
